﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManageContact.aspx.cs" EnableEventValidation="false"
    Inherits="WebAddressBook.ManageContact" %>

<%@ Register Src="~/HeaderControl.ascx" TagName="HeaderControl" TagPrefix="uc1" %>
<%@ Register Src="~/CoypyrightControl.ascx" TagName="CoypyrightControl" TagPrefix="uc2"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="shortcut icon" type="image/png" href="img/favicons/favicon.png" />
    <link rel="icon" type="image/png" href="img/favicons/favicon.png" />
    <link rel="apple-touch-icon" href="img/favicons/apple.png" />
    <!-- Main Stylesheet -->
    <link rel="stylesheet" href="css/style.css" type="text/css" />
    <!-- Colour Schemes
Default colour scheme is blue. Uncomment prefered stylesheet to use it.
<link rel="stylesheet" href="css/brown.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="css/gray.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="css/green.css" type="text/css" media="screen" />
<link rel="stylesheet" href="css/pink.css" type="text/css" media="screen" />  
<link rel="stylesheet" href="css/red.css" type="text/css" media="screen" />
-->
    <!-- Your Custom Stylesheet -->
    <link rel="stylesheet" href="css/custom.css" type="text/css" />
    <!--swfobject - needed only if you require <video> tag support for older browsers -->
    <script type="text/javascript" src="js/swfobject.js"></script>
    <!-- jQuery with plugins -->
    <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
    <!-- Could be loaded remotely from Google CDN : <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> -->
    <script type="text/javascript" src="js/jquery.ui.core.min.js"></script>
    <script type="text/javascript" src="js/jquery.ui.widget.min.js"></script>
    <script type="text/javascript" src="js/jquery.ui.tabs.min.js"></script>
    <!-- jQuery tooltips -->
    <script type="text/javascript" src="js/jquery.tipTip.min.js"></script>
    <!-- Superfish navigation -->
    <script type="text/javascript" src="js/jquery.superfish.min.js"></script>
    <script type="text/javascript" src="js/jquery.supersubs.min.js"></script>
    <!-- jQuery popup box -->
    <script type="text/javascript" src="js/jquery.nyroModal.pack.js"></script>
    <!-- jQuery form validation -->
    <script type="text/javascript" src="js/jquery.validate_pack.js"></script>
    <!-- Internet Explorer Fixes -->
    <!--[if IE]>
<link rel="stylesheet" type="text/css" media="all" href="css/ie.css"/>
<script src="js/html5.js"></script>
<![endif]-->
    <!--Upgrade MSIE5.5-7 to be compatible with MSIE8: http://ie7-js.googlecode.com/svn/version/2.1(beta3)/IE8.js -->
    <!--[if lt IE 8]>
<script src="js/IE8.js"></script>
<![endif]-->
    <script type="text/javascript">
        $(document).ready(function () {

            /* setup navigation, content boxes, etc... */
            //Administry.setup();

            /* progress bar animations - setting initial values */
            //Administry.progress("#progress1", 1, 6);

            // validate form on keyup and submit
            var validator = $("#sampleform").validate({
                rules: {
                    firstname: "required",
                    lastname: "required",
                    username: {
                        required: true,
                        minlength: 2
                    },
                    password: {
                        required: true,
                        minlength: 5
                    },
                    password_confirm: {
                        required: true,
                        minlength: 5,
                        equalTo: "#password"
                    },
                    email: {
                        required: true,
                        email: true
                    },
                    dateformat: "required",
                    terms: "required"
                },
                messages: {
                    firstname: "Enter your firstname",
                    lastname: "Enter your lastname",
                    username: {
                        required: "Enter a username",
                        minlength: jQuery.format("Enter at least {0} characters")
                    },
                    password: {
                        required: "Provide a password",
                        rangelength: jQuery.format("Enter at least {0} characters")
                    },
                    password_confirm: {
                        required: "Repeat your password",
                        minlength: jQuery.format("Enter at least {0} characters"),
                        equalTo: "Enter the same password as above"
                    },
                    email: {
                        required: "Please enter a valid email address",
                        minlength: "Please enter a valid email address"
                    },
                    dateformat: "Choose your preferred dateformat",
                    terms: " "
                },
                // the errorPlacement has to take the layout into account
                errorPlacement: function (error, element) {
                    error.insertAfter(element.parent().find('label:first'));
                },
                // specifying a submitHandler prevents the default submit, good for the demo
                submitHandler: function () {
                    //我注释掉的
                    //alert("Data submitted!");
                },
                // set new class to error-labels to indicate valid fields
                success: function (label) {
                    // set &nbsp; as text for IE
                    label.html("&nbsp;").addClass("ok");
                }
            });

            // propose username by combining first- and lastname
            $("#username").focus(function () {
                var firstname = $("#firstname").val();
                var lastname = $("#lastname").val();
                if (firstname && lastname && !this.value) {
                    this.value = firstname + "." + lastname;
                }
            });

        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <!-- Header -->
    <uc1:HeaderControl ID="HeaderControl1" runat="server" />
    <!-- End of Header -->
    <!-- Page title -->
    <div id="pagetitle">
        <div class="wrapper">
            <h1>
                联系人管理</h1>
            <!-- Quick search box -->
        </div>
    </div>
    <div id="page">
        <!-- Wrapper -->
        <div class="wrapper">
            <!-- Left column/section -->
            <section class="column full first">
            <div id="ChangeInfoDiv" runat="server">					
                            <fieldset>
							<legend>修改联系人</legend>
                            <table width="100%">
                            <tr>
                            <td>
                            <p>
                                <label class="required" for="enterprise">所属企业:</label><br/>
                                <asp:DropDownList ID="DDLEnterprise" runat="server" CssClass="half" 
                                    AutoPostBack="True"></asp:DropDownList>
                            </p>
                            </td>  
                            <td>
                            <p>
                                <label class="required" for="deptment">所属部门:</label><br/>
                                <asp:DropDownList ID="DDLDept" runat="server" CssClass="half"></asp:DropDownList>
                            </p>
                            </td>
                            </tr>
                            <tr>
                            <td>                            
							<p>
								<label class="required" for="firstname">姓:</label><br/>
								<input type="text" id="firstname" class="half" runat="server" value="" name="firstname"/>
							</p>
                            </td>
                            <td>
                            <p>
								<label class="required" for="lastname">名:</label><br/>
								<input type="text" id="lastname" class="half" runat="server" value="" name="lastname"/>
							</p>
                            </td>
                            </tr>
                            <tr>
                            <td>
                            <p>
								<label class="required" for="RBsex">性别:</label>
                                <p></p>
								<asp:RadioButtonList ID="RBsex" runat="server" RepeatDirection="Horizontal">
                                    <asp:ListItem Selected="True" Value="true">男</asp:ListItem>
                                    <asp:ListItem Value="false">女</asp:ListItem>
                                </asp:RadioButtonList>
							</p>
                            </td>
                            <td>
                            <p>
								<label class="required" for="phone">手机号码:</label><br/>
								<input type="text" id="phone" class="half" runat="server" value="" name="phone"/>
							</p>
                            </td>
                            </tr>
                            <tr>
                            <td>
                            <p>
								<label>办公座机:</label><br/>
								<input type="text" id="tel" class="half" runat="server" value="" name="tel"/>
							</p>
                            </td>
                            <td>
                            <p>
								<label>家庭电话:</label><br/>
								<input type="text" id="famirytel" class="half" runat="server" value="" name="famirytel"/>
							</p>
                            </td>
                            </tr>
                            <tr>
                            <td>
                            <p>
								<label>传真:</label><br/>
								<input type="text" id="fax" class="half" runat="server" value="" name="fax"/>
							</p>
                            </td>
                            <td>
                            <p>
								<label>邮箱:</label><br/>
								<input type="text" id="email" class="half" runat="server" value="" name="email"/>
							</p>
                            </td>
                            </tr>
                            <tr>
                            <td>
                            <p>
								<label>职位:</label><br/>
								<input type="text" id="station" class="half" runat="server" value="" name="station"/>
							</p>
                            </td>
                            <td>
                            <p>
								<label>地址:</label><br/>
								<input type="text" id="address" class="half" runat="server" value="" name="address"/>
							</p>
                            </td>
                            </tr>
                            </table>
					        <p>
                             <asp:Label ID="LbMessage" runat="server" Text=""></asp:Label>
                             <input type="hidden" id="LbEmployeeID" runat="server" value="" />  
                            </p>
							<p>
                                <asp:Button ID="BtChange" runat="server" Text="修改" CssClass="btn btn-blue" 
                                    onclick="BtChange_Click"></asp:Button>
                            </p>
						</fieldset>
                        </div>
                        <fieldset>
							<legend>查找联系人</legend>
                            <table width="100%">
                            <tr>
                            <td>
                            <p>
                                <label>所属企业:</label>
                                <asp:DropDownList ID="DDLEnterpriseForSearch" runat="server" CssClass="half" 
                                    AutoPostBack="True" 
                                    onselectedindexchanged="DDLEnterpriseForSearch_SelectedIndexChanged"></asp:DropDownList>
                           </p>
                            </td>
                            <td>
                            <p>
                                <label>所属部门:</label>
                                <asp:DropDownList ID="DDLDeptmentForSearch" runat="server" CssClass="half"></asp:DropDownList>
                            </p>
                            </td>
                            <td>
                            <p>
								<label>姓名:</label>
								&nbsp;<input type="text" id="nameForSearch" class="half" runat="server" value="" name="nameForSearch"/>
                            </p>
                            </td>
                            <td>
                            <p>
                                <asp:Button ID="BtSearch" runat="server" Text="查找" CssClass="btn btn-blue" 
                                    onclick="BtSearch_Click"></asp:Button>
                                <asp:Button ID="BtExport" runat="server" Text="导出" CssClass="btn btn-blue" onclick="BtExport_Click" 
                                     ></asp:Button>
                            </p>
                            </td>
                            </tr>
                            </table>
                            <div class="clear"></div>
                            <div>
                            <asp:GridView ID="GVContactList" runat="server" AutoGenerateColumns="False" 
                                    CssClass="stylized full" 
                                    onrowdatabound="GVContactList_RowDataBound" 
                                    onrowdeleting="GVContactList_RowDeleting" 
                                    onselectedindexchanging="GVContactList_SelectedIndexChanging">
                                <Columns>
                                    <asp:BoundField DataField="Name" HeaderText="姓名" SortExpression="Name" />
                                    <asp:BoundField DataField="DeptName" HeaderText="部门" SortExpression="DeptName" />
                                    <%--<asp:CheckBoxField DataField="Sex" HeaderText="性别" SortExpression="Sex" />--%>
                                     <asp:TemplateField HeaderText="性别">
                                     <ItemTemplate>
                                     <%#Convert.ToBoolean(Eval("Sex").ToString())? "男" : "女"%>
                                     </ItemTemplate>
                                     </asp:TemplateField>
                                    <asp:BoundField DataField="Phone" HeaderText="手机号码" SortExpression="Phone" />
                                    <asp:BoundField DataField="Tel" HeaderText="办公座机" SortExpression="Tel" />
                                    <asp:BoundField DataField="FamiryTel" HeaderText="家庭电话" SortExpression="FamiryTel" />
                                    <asp:BoundField DataField="Station" HeaderText="职位" SortExpression="Station" />
                                    <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                                    <asp:BoundField DataField="Fax" HeaderText="传真" SortExpression="Fax" />
                                    <asp:BoundField DataField="Address" HeaderText="地址" SortExpression="Address" />
                                    <asp:CommandField SelectText="编辑" ShowSelectButton="True" />
                                    <asp:CommandField ShowDeleteButton="True" />
                                </Columns>
                                </asp:GridView>
                            </div>
                        </fieldset>
           </section>
        </div>
    </div>
    <!-- Page footer -->
    <div>
        <uc2:CoypyrightControl ID="CoypyrightControl1" runat="server" />
    </div>
    <!--End Page footer -->
    </form>
</body>
</html>
